class Solution
{
public:
    int maximumDifference(vector<int> &nums)
    {
        int maxDiff = -1;
        int n = nums.size();
        for (int i = 0; i < n; ++i)
        {
            for (int j = i + 1; j < n; ++j)
            {
                maxDiff = max(maxDiff, nums[j] - nums[i]);
            }
        }
        return maxDiff > 0 ? maxDiff : -1;
    }
};